package liecai_class.day09;

import java.nio.CharBuffer;

public class Demo07 {
    public static void main(String[] args) {
        CharBuffer buf = CharBuffer.wrap("abcde".toCharArray());

        //1.遍历缓冲区
//        while(buf.position()<buf.limit()){
//            char c = buf.get();
//            System.out.println(c);
//        }
        //2.遍历缓冲区 remaining() = limit - position
//        while(buf.remaining()>0){
//            char c = buf.get();
//            System.out.println(c);
//        }
        //3.遍历缓冲区 hasRemaining()判断limit-position>0
        while(buf.hasRemaining()){
            char c = buf.get();
            System.out.println(c);
        }
    }
}
